<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %>
<rapid:override name="title">
    -关注列表
</rapid:override>
<rapid:override name="header-style">
</rapid:override>

<rapid:override name="content">
    <blockquote class="layui-elem-quote">
        <span class="layui-breadcrumb" lay-separator="/">
          <a href="/backIndex/homepage">首页</a>
          <a><cite>我的关注</cite></a>
          <a><cite>关注列表</cite></a>
        </span>
    </blockquote>
    <div>
        <c:choose>
            <c:when test="${listStatus==0}">
                <a href="javascript:void(0)" class="layui-btn">我关注的人</a>
                <a href="/interest/interestFollowList?listStatus=1" class="layui-btn layui-btn-primary">关注我的人</a>
            </c:when>
            <c:otherwise>
                <a href="/interest/interestFollowList?listStatus=0" class="layui-btn layui-btn-primary">我关注的人</a>
                <a href="javascript:void(0)" class="layui-btn">关注我的人</a>
            </c:otherwise>
        </c:choose>
    </div>
    <div class="layui-tab layui-tab-card">
        <form id="articleForm" method="post">
            <input type="hidden" name="currentUrl" id="currentUrl" value="">
            <table class="layui-table">
                <colgroup>
                    <col width="100">
                    <col width="500">
                    <col width="100">
                </colgroup>
                <thead>
                <tr>
                    <th>
                        <c:choose>
                            <c:when test="${listStatus==0}">
                                我的关注
                            </c:when>
                            <c:otherwise>
                                我的粉丝
                            </c:otherwise>
                        </c:choose>
                    </th>
                    <th>最新聊天</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${pageInfo.list}" var="interest" varStatus="num">
                    <tr style="height:80px;">
                        <td>
                            <c:choose>
                                <c:when test="${listStatus==0}">
                                    ${interest.followedUser.nickname}
                                </c:when>
                                <c:otherwise>
                                    ${interest.followerUser.nickname}
                                </c:otherwise>
                            </c:choose>
                        </td>
                        <td>
                            <c:choose>
                                <c:when test="${interest.message != null}">
                                    <p style="color:rgba(0,0,0,.35);font-size:12px;">
                                        <fmt:formatDate value="${interest.message.sendTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                                    </p>
                                    <hr>
                                    <p>${interest.message.messageContent}</p>
                                </c:when>
                                <c:otherwise>
                                    <p>没有聊天记录</p>
                                </c:otherwise>
                            </c:choose>
                        </td>
                        <td>
                            <a id="interest-btn-${num.index}"
                            <c:choose>
                                <c:when test="${listStatus==0}">
                                    href="javascript:void(0)" onclick="removeInterest(${interest.followedUser.userId})"
                                        class="layui-btn layui-btn-normal layui-btn-mini" style="width:60px;"
                                        <c:choose>
                                            <c:when test="${interest.isDouble==0}">
                                                onmouseenter="changeTest('取消关注','interest-btn-${num.index}')"
                                                onmouseleave="changeTest('已关注','interest-btn-${num.index}')">已关注</c:when>
                                            <c:otherwise>
                                                onmouseenter="changeTest('取消关注','interest-btn-${num.index}')"
                                                onmouseleave="changeTest('已互粉','interest-btn-${num.index}')"
                                                >已互粉</c:otherwise>
                                        </c:choose>
                                    </a>
                                </c:when>
                                <c:otherwise>
                                    <c:choose>
                                        <c:when test="${interest.isDouble==0}">
                                            href="javascript:void(0)" onclick="interest(${interest.followerUser.userId})"
                                                class="layui-btn layui-btn-normal layui-btn-mini" style="width:60px;"
                                                onmouseenter="changeTest('关注','interest-btn-${num.index}')"
                                                onmouseleave="changeTest('我的粉丝','interest-btn-${num.index}')">
                                                我的粉丝
                                            </a>
                                        </c:when>
                                        <c:otherwise>
                                            href="javascript:void(0)" onclick="removeInterest(${interest.followerUser.userId})"
                                                class="layui-btn layui-btn-normal layui-btn-mini" style="width:60px;"
                                                onmouseenter="changeTest('取消关注','interest-btn-${num.index}')"
                                                onmouseleave="changeTest('已互粉','interest-btn-${num.index}')">
                                                已互粉
                                            </a>
                                        </c:otherwise>
                                    </c:choose>
                                </c:otherwise>
                            </c:choose>
                            &nbsp; &nbsp;
                            <a href="/message"
                               class="layui-btn layui-btn-primary layui-btn-mini" style="color:black!important;">进入聊天
                            </a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </form>
        <%@ include file="../Public/paging.jsp" %>
    </div>

</rapid:override>
<rapid:override name="footer-script">
    <script></script>
</rapid:override>
<%@ include file="../Public/framework.jsp" %>
